class QueryEntity {
    constructor({
                    id = '',
                    idcId = '',
                    startTime = '',
                    endTime = '',
                    idAction = SearchActionConstant.ACCURATE,
                    idcIdAction = SearchActionConstant.ACCURATE,
                } = {}) {
        this.id = id;
        this.idcId = idcId;
        this.startTime = startTime;
        this.endTime = endTime;
        this.idAction = idAction;
        this.idcIdAction = idcIdAction;
    }
}

new BasicTableVue({
    data: function () {
        return {
            api: insWorkOrderApi,
            columns: [
                new TableColumn({
                    type: 'selection',
                    width: 30,
                    align: 'center',
                }),
                new TableColumn({
                    prop: 'id',
                    title: '指令ID',
                }),
                new TableColumn({
                    prop: 'idcId',
                    title: '经营者ID',
                }),
                new TableColumn({
                    prop: 'insType',
                    title: '指令类型',
                    formatter: this.insTypeFormat,
                }),
                new TableColumn({
                    prop: 'orderType',
                    title: '工单类型',
                    formatter: this.orderTypeFormat,
                }),
                new TableColumn({
                    prop: 'orderStatus',
                    title: '工单状态',
                    formatter: this.orderStatusFormat,
                }),
                new TableColumn({
                    prop: 'docName',
                    title: '文档名称',
                }),
                new TableColumn({
                    prop: 'expiredTime',
                    title: '截止期限',
                    formatter: TableColumn.datetimeFormat,
                }),
                new TableColumn({
                    prop: 'createTime',
                    title: '生成时间',
                    formatter: TableColumn.datetimeFormat,
                }),
                new TableColumn({
                    prop: 'updateTime',
                    title: '更新时间',
                    formatter: TableColumn.datetimeFormat,
                }),
                new TableColumn({
                    prop: 'operating',
                    title: '操作',
                    sortable: false,
                    customComponent: 'true',
                }),
            ],
        }
    },
    methods: {
        createForm() {
            return new QueryEntity();
        },
        insTypeFormat(row, column, value, index) {
            var result = '';
            value = parseInt(value)
            switch (value) {
                case 1:
                    result = '下发工单';
                    break;
                case 2:
                    result = '上报文件';
                    break;
                case 3:
                    result = '反馈回执';
                    break;
            }
            return result;
        },
        orderTypeFormat(row, column, value, index) {
            var result = '';
            value = parseInt(value)
            switch (value) {
                case 1:
                    result = '工单';
                    break;
                case 2:
                    result = '通知';
                    break;
                case 3:
                    result = '文件';
                    break;
                case 4:
                    result = '反馈';
                    break;
            }
            return result;
        },
        orderStatusFormat(row, column, value, index) {
            var result = '';
            value = parseInt(value)
            switch (value) {
                case 1:
                    result = '下发';
                    break;
                case 2:
                    result = '已阅知';
                    break;
                case 3:
                    result = '处理完成';
                    break;
                case 4:
                    result = '不予处理';
                    break;
                case 5:
                    result = '延期处理';
                    break;
                case 6:
                    result = '正在处理';
                    break;
            }
            return result;
        },
        forwardUpdate(data) {
            forward('/command-manage/modify/admin_filenotify_modify', data);
        },
        report(data) {
            console.log(data);
        },
        init() {

        },
    },
    watch: {
        'form.timeArray': function (newVal, oldVal) {
            if (newVal) {
                this.form.startTime = newVal[0];
                this.form.endTime = newVal[1];
            } else {
                this.form.startTime = '';
                this.form.endTime = '';
            }

        },
    },
})
